package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming.matching;


import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 描述：匹配中
 */
public class Matching {
    static void show(Matcher matcher, int val) {
        System.out.println(
                matcher.test(IntStream.rangeClosed(1, 9)
                                .boxed().peek(n -> System.out.format("%d ", n)),
                        n -> n < val));
    }

    public static void main(String[] args) {
        show(Stream::allMatch, 10);
        show(Stream::allMatch, 4);
        show(Stream::anyMatch, 2);
        show(Stream::anyMatch, 0);
        show(Stream::anyMatch, 5);
        show(Stream::anyMatch, 0);
    }
}
